package edu.colorado.cs.correll.cudroplet.shaperecognition;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

public class CircumcircleDictionary {
	
	/**
	 * Look up circumcircle by first robot
	 */
	public Map<Robot, Set<Circumcircle>> circumcircleMap = new HashMap<Robot, Set<Circumcircle>>();
	
	/**
	 * Look up neighboring robots by robot
	 */
	public Map<Robot, Set<Robot>> robotMap = new HashMap<Robot, Set<Robot>>();
	
	public CircumcircleDictionary(Set<Circumcircle> circumcircles) {
		// create circumcircleMap and robotMap
		for (Circumcircle circumcircle : circumcircles) {
			Robot a = circumcircle.a;
			Robot b = circumcircle.b;

			Robot[] robots = { a, b };
			for (Robot robot : robots) {
				robot.alphaLeader = null;
				if (!robotMap.containsKey(robot)) {
					robotMap.put(robot, new HashSet<Robot>());
				}
			}
			robotMap.get(a).add(b);
			robotMap.get(b).add(a);
			
			if (!circumcircleMap.containsKey(a)) {
				circumcircleMap.put(a, new HashSet<Circumcircle>());
			}
			circumcircleMap.get(a).add(circumcircle);
		}
	}

}
